(:: pragma bea:global-element-parameter parameter="$request1" element="ns2:request" location="../wsdl/cli_update_available_request.xsd" ::)
(:: pragma  parameter="$error" type="anyType" ::)
(:: pragma bea:global-element-return element="ns3:agregaDocumentoReq" location="../../../CL_BUC_RegistrarError_IMPL/Resource/wsdl/XsdAlarmaMsg.xsd" ::)

declare namespace xf = "http://tempuri.org/CL_OSB_ClienteCrear_COMP/Resource/xq/RegistrarErrorUpdateATG/";
declare namespace ns0 = "http://datos.sodimac.com/commons_v2.0";
declare namespace ns1 = "http://sodimac.cl/buc/alarma";
declare namespace ns3 = "http://sodimac.cl/buc/alarmaMsg";
declare namespace ns2 = "http://www.falabella.com/schemas/cli_update_available";

declare function xf:RegistrarErrorUpdateATG($request1 as element(ns2:request),
    $error as element(*))
    as element(ns3:agregaDocumentoReq) {
        <ns3:agregaDocumentoReq>
            <payloadReq>
                <ns1:doc_type>UPDATE</ns1:doc_type>
                <ns1:origin>ATG</ns1:origin>
                <ns1:destination>ATG</ns1:destination>
                <ns1:xml_origin>
                    {
                        fn-bea:serialize(
                        ($request1) )
                    }
</ns1:xml_origin>
                <ns1:rut>{ data($request1/ns2:cli_update_available/ns2:update_infos/ns2:update_info[1]/ns2:rut) }</ns1:rut>
                <ns1:email>{ data($request1/ns2:cli_update_available/ns2:update_infos/ns2:update_info[1]/ns2:email) }</ns1:email>
                <ns1:error>{ data($error) }</ns1:error>
                <ns1:xml_trans>
                    {
                        fn-bea:serialize(
                        ($request1) )
                    }
</ns1:xml_trans>
            </payloadReq>
        </ns3:agregaDocumentoReq>
};

declare variable $request1 as element(ns2:request) external;
declare variable $error as element(*) external;

xf:RegistrarErrorUpdateATG($request1,
    $error)
